{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">编辑管理员</div>
    <div class="layui-card-body">
        <form class="layui-form" method="post">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">基本信息</li>
                    <li>其他信息</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <!-- -->
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" autocomplete="off" placeholder="用户名" class="layui-input" value="{$data.username}">
                            </div>
                            <div class="layui-form-mid layui-word-aux">3-20位字符，可由字母和数字，下划线"_"及破折号"-"组成。</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">密码</label>
                            <div class="layui-input-inline">
                                <input type="password" name="password" autocomplete="off" placeholder="密码" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">不修改留空即可。</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">确认密码</label>
                            <div class="layui-input-inline">
                                <input type="password" name="password_confirm" autocomplete="off" placeholder="确认密码" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">请再次输入您的密码</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">E-mail</label>
                            <div class="layui-input-inline">
                                <input type="text" name="email" lay-verify="required|email" autocomplete="off" placeholder="E-mail" class="layui-input" value="{$data.email}">
                            </div>
                            <div class="layui-form-mid layui-word-aux">填写完整邮箱，如 yzncms@163.com</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">真实姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="nickname" autocomplete="off" placeholder="真实姓名" class="layui-input" value="{$data.nickname}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">权限组</label>
                            <div class="layui-input-inline">
                                <select name="roleid" lay-filter="roleid" lay-verify="required">
                                    {volist name="roles" id="vo"}
                                    <option value="{$vo['id']}" {eq name="vo.id" value="$data.roleid" }selected{/eq}>{$vo['title']}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <!-- -->
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-form-item">
                            <label class="layui-form-label">头像</label>
                            <div class="layui-input-inline w350">
                                <input type="text" name="avatar" id="avatar" placeholder="头像" class="layui-input" value="{$data.avatar}">
                            </div>
                            <div class="layui-input-inline">
                                <button class="layui-btn layui-btn-normal js-btn-upload" type="button" data-for-imgid="img-avatar" data-for-elemid="avatar" data-callback="uploadImgSuccess">上传头像</button>
                                <img src="{$data.avatar}" id="img-avatar" class="preview-img" width="40" height="40" style="margin-left:5px;cursor:pointer">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-elem">
                <input type="hidden" name="id" value="{$data.id}">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
                        <button class="layui-btn layui-btn-normal" type="button" onclick="javascript:history.back(-1);">返回</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="script"}
<script src="__STATIC__/libs/jquery-plugins/jquery.previewImage.js"></script>
<script src="__STATIC__/admin/js/form.js"></script>
<script>
    $(function () {
        $('.preview-img').previewImage();
    });

    function uploadImgSuccess(res, item) {
        //console.log(res);
    }
</script>
{/block}